<?php 
defined('_JEXEC') or die('Restricted access');

AdminUIHelper::startAdminArea ();
?>
<?php //------------------------------------ ?>



<?php //---------------------------------------?>
<script type="text/javascript">
function CheckMail(email) {
	var rs = new RegExp("([A-Za-z0-9_.-]){2,}@([A-Za-z0-9_.-]){2,}.([A-Za-z0-9_.-]){2,}");
	if(email.match(rs) == null) return 0;
	return 1;
}
function limiter(){
	// check can bo blank
	var name= document.adminForm.sn_idcanbo.value;
	if(name=="0") document.getElementById('loicanbo').innerHTML="(!)  Select one.!";
	else  document.getElementById('loicanbo').innerHTML="";
	// check can bo blank
	var quyen= document.adminForm.quyen.value;
	if(quyen=="") document.getElementById('loiquyen').innerHTML="(!)  Select one.!";
	else  document.getElementById('loiquyen').innerHTML="";
	// check tieu de blank
	var namecb= document.adminForm.namecb.value;
	if(namecb=="") document.getElementById('loiname').innerHTML="(!)  Not blank.!";
	else  document.getElementById('loiname').innerHTML="";
	// check bat dau blank
	var username= document.adminForm.username.value;
	if(username=="") document.getElementById('loiusername').innerHTML="(!) Not blank.!";
	else  
		{
		if(username.length<8) document.getElementById('loiusername').innerHTML=" Length >= 8";
		else document.getElementById('loiusername').innerHTML="";
		}
	// check dia diem
	var email= document.adminForm.email.value;
	email=CheckMail(email);
	if(email==0) document.getElementById('loiemail').innerHTML="(!) Not email.!";
	else  document.getElementById('loiemail').innerHTML="";
	// check ket thuc
	var password= document.adminForm.password.value;
	if(password=="") document.getElementById('loipassword').innerHTML="(!) Not blank.!";
	else  
	{
		if(password.length<6) document.getElementById('loipassword').innerHTML=" Length >=6 ";
		else document.getElementById('loipassword').innerHTML="";
	}
	// check tinh trang
	var loipassword2= document.adminForm.password2.value;
	if(loipassword2!=password) document.getElementById('loipassword2').innerHTML="(!) Not match password.!";
	else  document.getElementById('loipassword2').innerHTML="";
	// check sn_thanhtich
	var gid= document.adminForm.gid.value;
	if(gid=="") document.getElementById('loigid').innerHTML="(!) Not blank.!";
	else  document.getElementById('loigid').innerHTML="";
			}
</script>
<form  method="post" name="adminForm"  onmousemove="limiter()" >
	<div class="col width-40">
		<fieldset class="adminform">
		<legend><?php echo JText::_( 'Cán bộ - Phân quyền' ); ?></legend>
			<table class="admintable">
			<tr>
				<td class="key"><?php echo JText::_('Đơn vị')?></td>
				<td>
					<?php echo $this->list['donvi']; ?>
				</td>
			</tr>
			<tr>
				<td class="key"><?php echo JText::_('Phòng ban')?></td>
				<td>
					<?php echo $this->list['phongban']; ?>
				</td>
			</tr>
			<tr>
				<td class="key">
				<?php echo JText::_('Cán bộ')?>
				</td>
				<td>
					<?php echo $this->list['canbo']; ?>
					<b style="color:red;text-align:center;" id="loicanbo"  ></b>
				</td>
			</tr>
				<tr>
					<td class="key">
						<label >
							<?php echo JText::_( 'Quyen truy cap' ); ?>
						</label>
					</td>
				<td>
					<select name="quyen" id="quyen" class="inputbox"  style="width:220px;" >
					    <?php 
					       if($this->quyen=='')
					       	 echo '<option select="selected"  value="">---- Chọn quyền ----</option>'; 
					       else 
					    	echo '<option select="selected"  value="'.$this->quyen.'">'.$this->quyen.'</option>'; 
					    ?>
						<option value="canbo"><?php echo JText::_('Cán bộ')?></option>
						<option value="qlphong"><?php echo JText::_('Quản lý phòng')?></option>
						<option value="qldonvi"><?php echo JText::_('Quản lý đơn vị')?></option>
						<option value="admin"><?php echo JText::_('Admin')?></option>
					</select>
					<b style="color:red;text-align:center;" id="loiquyen"  ></b>
				</td>
				</tr>
			</table>
		</fieldset>
	</div>
	<div class="col width-60">
		<fieldset class="adminform">
		<legend><?php echo JText::_( 'Đăng kí hệ thống' ); ?></legend>
			<table class="admintable" cellspacing="1">
				<tr>
					<td class="key">
						<label for="name">
							<?php echo JText::_( 'Name' ); ?>
						</label>
					</td>
					<td>
						<input type="text" name="namecb" id="namecb" class="inputbox" size="40" value="<?php echo $this->namecb; ?>" disabled="disabled" />
						<b style="color:red;text-align:center;" id="loiname"  ></b>
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="username">
							<?php echo JText::_( 'Username' ); ?>
						</label>
					</td>
					<td>
						<input  onkeyup="limiter()"  type="text" name="username" id="username" class="inputbox" size="40" value="<?php //echo $this->user->get('username'); ?>" autocomplete="off" />
						<b style="color:red;text-align:center;" id="loiusername"  ></b>
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="email">
							<?php echo JText::_( 'Email' ); ?>
						</label>
					</td>
					<td>
						<input onkeyup="limiter()"  class="inputbox" type="text" name="email" id="email" size="40" value="<?php //echo $this->user->get('email'); ?>" />
						<b style="color:red;text-align:center;" id="loiemail"  ></b>
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="password">
							<?php echo JText::_( 'New Password' ); ?>
						</label>
					</td>
					<td>
						<?php if(0/*!$this->user->get('password')*/) : ?>
							<input onkeyup="limiter()"  class="inputbox disabled" type="password" name="password" id="password" size="40" value="" disabled="disabled" />
						<?php else : ?>
							<input onkeyup="limiter()"  class="inputbox" type="password" name="password" id="password" size="40" value=""/>
						<?php endif; ?>
						<b style="color:red;text-align:center;" id="loipassword"  ></b>
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="password2">
							<?php echo JText::_( 'Verify Password' ); ?>
						</label>
					</td>
					<td>
						<?php if(0/*!$this->user->get('password')*/) : ?>
							<input onkeyup="limiter()"  class="inputbox disabled" type="password" name="password2" id="password2" size="40" value="" disabled="disabled" />
						<?php else : ?>
							<input onkeyup="limiter()"  class="inputbox" type="password" name="password2" id="password2" size="40" value=""/>
						<?php endif; ?>
						<b style="color:red;text-align:center;" id="loipassword2"  ></b>
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						<label for="gid">
							<?php echo JText::_( 'Group' ); ?>
						</label>
					</td>
					<td>
						<?php echo $this->lists['gid']; ?>
						<b style="color:red;text-align:center;" id="loigid"  ></b>
					</td>
				</tr>
				<?php //if ($this->me->authorize( 'com_users', 'block user' )) { ?>
				<tr>
					<td class="key">
						<?php echo JText::_( 'Block User' ); ?>
					</td>
					<td>
						<?php echo $this->lists['block']; ?>
					</td>
				</tr>
				<?php// } if ($this->me->authorize( 'com_users', 'email_events' )) { ?>
				<tr>
					<td class="key">
						<?php echo JText::_( 'Receive System Emails' ); ?>
					</td>
					<td>
						<?php echo $this->lists['sendEmail']; ?>
					</td>
				</tr>
				<?php //} if( $this->user->get('id') ) { ?>
				<tr>
					<td class="key">
						<?php echo JText::_( 'Register Date' ); ?>
					</td>
					<td>
						<?php echo JFactory::getDate()->toMysql(); //JHTML::_('date', $this->user->get('registerDate'), '%Y-%m-%d %H:%M:%S');?>
					</td>
				</tr>
				<tr>
					<td class="key">
						<?php echo JText::_( 'Last Visit Date' ); ?>
					</td>
					<td>
						<?php //echo $lvisit; ?>
					</td>
				</tr>
				<?php //} ?>
			</table>
		</fieldset>
	</div>

	<div class="clr"></div>
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="contact_id" value="" />

</form>
